package a.j;

import a.c.ab;
import a.c.bb;
import a.c.d;
import a.c.e;
import a.c.k;
import a.c.m;
import a.c.q;
import a.f.pb;
import a.f.zb;
import a.f.zc;
import a.j.a.j;

import java.util.Map;
import java.util.WeakHashMap;

public class sd
  implements td
{
  private static final String a = "HierarchyManager.InterEdgeData.SOURCE_PORT";
  private static final String b = "HierarchyManager.InterEdgeData.TARGET_PORT";
  private boolean c = true;
  private WeakHashMap e = new WeakHashMap();
  public static boolean f;
  
  public boolean a()
  {
    return this.c;
  }
  
  public void a(boolean paramBoolean)
  {
    this.c = paramBoolean;
  }
  
  public void a(e parame)
  {
    c_ localc_ = c();
    this.e.put(parame, localc_);
    d(parame);
  }
  
  public void b(e parame)
  {
    c_ localc_ = (c_)this.e.get(parame);
    if (localc_ == null) {
      return;
    }
    ab localab = new ab(localc_.a.keySet().iterator());
    a(localab, parame);
    localc_.a.clear();
    this.e.remove(parame);
  }
  
  protected ab c(e parame)
  {
    boolean bool2 = ld.E;
    j localj = j.a(parame.g());
    if ((bool2) || (localj != null))
    {
      if (bool2) {
        break label48;
      }
      if (!localj.n(parame)) {}
    }
    else
    {
      return new ab();
    }
    label48:
    boolean bool1 = localj.m(parame);
    if (bool1) {
      return a(parame, parame.g());
    }
    return e(parame);
  }
  
  protected void a(d paramd, e parame)
  {
    c(paramd, parame);
  }
  
  protected void b(d paramd, e parame)
  {
    if (paramd.c() != null) {
      d(paramd, parame);
    }
  }
  
  private void d(e parame)
  {
    boolean bool = ld.D;
    ab localab = c(parame);
    m localm = localab.l();
    do
    {
      if (!localm.e()) {
        break;
      }
      d locald = localm.a();
      a(locald, parame);
      localm.f();
    } while (!bool);
  }
  
  private void a(ab paramab, e parame)
  {
    boolean bool = ld.D;
    m localm = paramab.l();
    do
    {
      if (!localm.e()) {
        break;
      }
      d locald = localm.a();
      b(locald, parame);
      localm.f();
    } while (!bool);
  }
  
  private void a(e parame, j paramj, bb parambb, boolean[] paramArrayOfBoolean)
  {
    boolean bool2 = ld.E;
    boolean bool1 = ld.D;
    parambb.add(parame);
    if ((bool2) || (paramj.m(parame)))
    {
      a.c.w localw = paramj.r(parame);
      do
      {
        if (!localw.e()) {
          break;
        }
        e locale = localw.d();
        paramArrayOfBoolean[locale.f()] = true;
        a(locale, paramj, parambb, paramArrayOfBoolean);
        localw.f();
      } while (!bool1);
    }
  }
  
  protected boolean a(d paramd, g paramg)
  {
    boolean bool = ld.E;
    k localk = a(paramg);
    if ((bool) || (localk != null)) {
      if (bool) {}
    }
    return localk.getBool(paramd);
  }
  
  private ab a(e parame, q paramq)
  {
    boolean bool2 = ld.E;
    boolean bool1 = ld.D;
    j localj = j.a(paramq);
    bb localbb = new bb();
    boolean[] arrayOfBoolean = new boolean[paramq.j()];
    a(parame, localj, localbb, arrayOfBoolean);
    ab localab = new ab();
    a.c.w localw = localbb.l();
    label155:
    do
    {
      if (!localw.e()) {
        break;
      }
      e locale = localw.d();
      m localm = locale.l();
      do
      {
        do
        {
          if (!localm.e()) {
            break label155;
          }
          d locald = localm.a();
          if (bool1) {
            break;
          }
          if (locale != parame)
          {
            if (bool2) {
              continue;
            }
            if (arrayOfBoolean[locald.a(locale).f()] != 0) {}
          }
          else
          {
            localab.add(locald);
          }
          localm.f();
        } while (!bool1);
        localw.f();
      } while (bool2);
    } while (!bool1);
    return localab;
  }
  
  private static k a(g paramg)
  {
    boolean bool = ld.E;
    k localk = paramg.c(qf.Eb);
    if (!bool) {
      if ((localk == null) && ((bool) || (paramg.K() != null)) && ((bool) || (paramg.K().j() != paramg))) {
        localk = paramg.K().j().c(qf.Eb);
      }
    }
    return localk;
  }
  
  private ab e(e parame)
  {
    return new ab(parame.l());
  }
  
  private c_ c()
  {
    return new c_(null);
  }
  
  private c_ f(e parame)
  {
    if (!ld.E) {
      if (this.e.containsKey(parame)) {
        return (c_)this.e.get(parame);
      }
    }
    c_ localc_ = c();
    this.e.put(parame, localc_);
    return localc_;
  }
  
  private void c(d paramd, e parame)
  {
    boolean bool2 = ld.E;
    c_ localc_ = f(parame);
    g localg = (g)paramd.c();
    a.d.w localw1 = localg.r(paramd);
    a.d.w localw2 = localg.s(paramd);
    a.d.w localw3 = localg.o(parame);
    double d1 = localg.s(parame) / 2.0D;
    double d2 = localg.t(parame) / 2.0D;
    a.d.w localw4 = new a.d.w(d1 == 0.0D ? 0.0D : (localw1.a() - localw3.a()) / d1, d2 == 0.0D ? 0.0D : (localw1.b() - localw3.b()) / d2);
    a.d.w localw5 = new a.d.w(d1 == 0.0D ? 0.0D : (localw2.a() - localw3.a()) / d1, d2 == 0.0D ? 0.0D : (localw2.b() - localw3.b()) / d2);
    boolean bool1 = a(paramd, localg);
    byte b1 = 3;
    byte b2 = 3;
    if (bool1)
    {
      localObject = localg.t(paramd);
      if (!bool2) {
        if (paramd.e() == parame) {
          b1 = ud.a(null, (tb)localObject, true, (byte)0);
        }
      }
      if (paramd.f() == parame) {
        b2 = ud.a(null, (tb)localObject, false, (byte)0);
      }
    }
    Object localObject = new b_(bool1, b1, b2, new pb(localg.b(paramd)), paramd.e(), paramd.f());
    ((b_)localObject).g = localw4;
    ((b_)localObject).h = localw5;
    if (!bool2) {
      if (a())
      {
        j localj = localg.K();
        if (bool2) {
          break label619;
        }
        if (localj != null) {
          if (!bool2)
          {
            if (localj.m(parame))
            {
              int i = localj.p(paramd.e()) == parame ? 1 : 0;
              int j = localj.p(paramd.f()) == parame ? 1 : 0;
              if (bool2) {
                return;
              }
              if ((i ^ j) != 0)
              {
                jd localjd;
                if (!bool2) {
                  if (i != 0)
                  {
                    localjd = jd.b(localg.t(paramd));
                    if ((bool2) || (localjd != null))
                    {
                      if (bool2) {
                        break label463;
                      }
                      if (a(localjd, localg.w(paramd.e()))) {
                        ((b_)localObject).i = localjd;
                      }
                    }
                  }
                }
                if (j != 0)
                {
                  label463:
                  localjd = jd.d(localg.t(paramd));
                  if (bool2) {
                    break label619;
                  }
                  if (localjd != null)
                  {
                    if (bool2) {
                      break label619;
                    }
                    if (a(localjd, localg.w(paramd.f())))
                    {
                      ((b_)localObject).j = localjd;
                      if (bool2) {
                        return;
                      }
                      if (!ld.D) {}
                    }
                  }
                }
              }
            }
            else
            {
              if (bool2) {
                break label619;
              }
            }
          }
          else if (localj.l(parame))
          {
            if (bool2) {
              break label619;
            }
            if (localj.e(paramd))
            {
              if (!bool2)
              {
                if (paramd.e() == parame) {
                  ((b_)localObject).i = a(localj, paramd, parame, true);
                }
                if (bool2) {
                  break label619;
                }
              }
              if (paramd.f() == parame) {
                ((b_)localObject).j = a(localj, paramd, parame, false);
              }
            }
          }
        }
      }
    }
    label619:
    localc_.a().put(paramd, localObject);
  }
  
  private static boolean a(jd paramjd, ld paramld)
  {
    return jd.a(paramjd, paramld);
  }
  
  private static jd a(j paramj, d paramd, e parame, boolean paramBoolean)
  {
    boolean bool = ld.E;
    String str = paramBoolean ? "HierarchyManager.InterEdgeData.SOURCE_PORT" : "HierarchyManager.InterEdgeData.TARGET_PORT";
    Map localMap = (Map)a(paramj, paramd, str);
    if ((bool) || (localMap != null))
    {
      if (bool) {
        break label58;
      }
      if (!localMap.isEmpty()) {}
    }
    else
    {
      return null;
    }
    label58:
    e locale1 = paramBoolean ? paramj.b(paramd) : paramj.c(paramd);
    e locale2;
    if ((bool) || (locale1 == parame))
    {
      locale2 = locale1;
      if (!ld.D) {}
    }
    else
    {
      q localq = paramj.o(parame);
      locale2 = paramj.a(locale1, localq);
    }
    return (jd)localMap.get(locale2);
  }
  
  private void d(d paramd, e parame)
  {
    boolean bool4 = ld.E;
    boolean bool3 = ld.D;
    c_ localc_ = (c_)this.e.get(parame);
    b_ localb_ = (b_)localc_.a().get(paramd);
    if (localb_ == null) {
      return;
    }
    q localq = parame.g();
    if (!bool4) {
      if (!(localq instanceof g)) {
        return;
      }
    }
    g localg = (g)localq;
    e locale1 = paramd.e();
    e locale2 = paramd.f();
    zb localzb = localb_.d;
    a.d.w localw1 = localzb.c();
    a.d.w localw2 = localzb.d();
    double d1 = localb_.g.a();
    double d2 = localb_.g.b();
    double d3 = localb_.h.a();
    double d4 = localb_.h.b();
    double d5 = d1 * localg.s(parame) / 2.0D;
    double d6 = d2 * localg.t(parame) / 2.0D;
    double d7 = d3 * localg.s(parame) / 2.0D;
    double d8 = d4 * localg.t(parame) / 2.0D;
    double d9 = localg.m(parame) + d5;
    double d10 = localg.n(parame) + d6;
    double d11 = localg.m(parame) + d7;
    double d12 = localg.n(parame) + d8;
    zc localzc1 = localg.d(locale1);
    zc localzc2 = localg.d(locale2);
    a.d.w localw3;
    if (new Rectangle2D.Double(localzc1.a() - 1.0D, localzc1.b() - 1.0D, localzc1.c() + 2.0D, localzc1.d() + 2.0D).contains(d9, d10))
    {
      localw3 = new a.d.w(d9, d10);
      if (bool4) {
        break label412;
      }
      if (!bool3) {}
    }
    else
    {
      localw3 = localg.o(locale1);
    }
    label412:
    a.d.w localw4;
    if (new Rectangle2D.Double(localzc2.a() - 1.0D, localzc2.b() - 1.0D, localzc2.c() + 2.0D, localzc2.d() + 2.0D).contains(d11, d12))
    {
      localw4 = new a.d.w(d11, d12);
      if (bool4) {
        break label463;
      }
      if (!bool3) {}
    }
    else
    {
      localw4 = localg.o(locale2);
    }
    localg.a(new ab(paramd).l());
    label463:
    tb localtb1 = localg.t(paramd);
    localtb1.s();
    int i = 0;
    do
    {
      do
      {
        if (i >= localzb.a()) {
          break;
        }
        a.d.w localw5 = localzb.a(i);
        localtb1.a(localw5.a(), localw5.b());
        i++;
        if (bool4) {
          break label556;
        }
        if (bool3) {
          break label549;
        }
      } while (!bool3);
    } while (bool4);
    boolean bool1 = a(paramd, parame, true);
    label549:
    label556:
    boolean bool2 = a(paramd, parame, false);
    if (!bool4)
    {
      if (bool1) {
        localg.c(paramd, localw3);
      }
    }
    else
    {
      if (bool4) {
        break label595;
      }
      if (!bool3) {
        break label593;
      }
    }
    localtb1.a(localw1);
    label593:
    label595:
    if (!bool4)
    {
      if (bool2) {
        localg.d(paramd, localw4);
      }
    }
    else
    {
      if (bool4) {
        break label633;
      }
      if (!bool3) {
        break label628;
      }
    }
    localtb1.b(localw2);
    label628:
    label633:
    if (!bool4) {
      if (localb_.a)
      {
        if (!bool4) {
          if (bool1) {
            ud.a(null, localtb1, true, localb_.b);
          }
        }
        if (bool4) {
          break label691;
        }
        if (bool2) {
          ud.a(null, localtb1, false, localb_.c);
        }
      }
    }
    if (a())
    {
      label691:
      j localj = localg.K();
      if ((bool4) || (localj != null))
      {
        if (!bool4) {
          if (localj.l(parame))
          {
            if (bool4) {
              break label810;
            }
            if (localj.e(paramd))
            {
              if (!bool4) {
                if (bool1)
                {
                  a(localj, paramd, localb_, true);
                  localb_.i = null;
                }
              }
              if (!bool4)
              {
                if (!bool2) {
                  return;
                }
                a(localj, paramd, localb_, false);
                localb_.j = null;
              }
            }
          }
        }
        if ((bool4) || ((bool3) && ((bool4) || (localj.m(parame)))))
        {
          label810:
          int j = localj.p(paramd.e()) == parame ? 1 : 0;
          int k = localj.p(paramd.f()) == parame ? 1 : 0;
          if ((j ^ k) != 0)
          {
            tb localtb2 = localg.t(paramd);
            if (!bool4) {
              if (j != 0) {
                jd.a(localb_.i, localtb2);
              }
            }
            if (k != 0) {
              jd.b(localb_.j, localtb2);
            }
          }
        }
      }
    }
  }
  
  private static void a(j paramj, d paramd, b_ paramb_, boolean paramBoolean)
  {
    e locale = paramBoolean ? paramb_.e : paramb_.f;
    jd localjd = paramBoolean ? paramb_.i : paramb_.j;
    String str = paramBoolean ? "HierarchyManager.InterEdgeData.SOURCE_PORT" : "HierarchyManager.InterEdgeData.TARGET_PORT";
    Object localObject = (Map)a(paramj, paramd, str);
    if (!ld.E) {
      if (localObject == null)
      {
        localObject = new WeakHashMap();
        a(paramj, paramd, str, localObject);
      }
    }
    ((Map)localObject).put(locale, localjd);
  }
  
  private static Object a(j paramj, d paramd, String paramString)
  {
    return paramj.d(paramd).a(paramString);
  }
  
  private static void a(j paramj, d paramd, String paramString, Object paramObject)
  {
    paramj.d(paramd).a(paramString, paramObject);
  }
  
  protected boolean a(d paramd, e parame, boolean paramBoolean)
  {
    boolean bool = ld.E;
    c_ localc_ = (c_)this.e.get(parame);
    if (!bool) {
      if (localc_ == null) {
        return false;
      }
    }
    b_ localb_ = (b_)localc_.a().get(paramd);
    if (localb_ == null) {
      return false;
    }
    if (paramBoolean) {
      return (bool) || ((localb_.e == parame) || (localb_.e != paramd.e()));
    }
    return (bool) || ((localb_.f == parame) || (localb_.f != paramd.f()));
  }
  
  private static class c_
  {
    private WeakHashMap a = new WeakHashMap();
    
    private c_() {}
    
    public Map a()
    {
      return this.a;
    }
    
    c_(sd.0 param0)
    {
      this();
    }
  }
  
  private static class b_
  {
    boolean a;
    byte b;
    byte c;
    zb d;
    e e;
    e f;
    a.d.w g;
    a.d.w h;
    jd i;
    jd j;
    
    b_(boolean paramBoolean, byte paramByte1, byte paramByte2, zb paramzb, e parame1, e parame2)
    {
      this.a = paramBoolean;
      this.b = paramByte1;
      this.c = paramByte2;
      this.e = parame1;
      this.f = parame2;
      this.d = paramzb;
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.j.sd

 * JD-Core Version:    0.7.0.1

 */